<template>
	<!-- 联系客服 -->
	<view id="contact_service">
		<!-- 身 -->
		<view class="contact_service_main" style="background-color: #F1F1F1;">
			<!-- 时间 -->
			<view class="time">2020/6/29 9:18</view>
			<!-- 右边我发的消息 -->
			<view class="main_right">
				<view>我发的消息我发的消息我发的消息我发的消息我发的消息我发的消息我发的消息我发的消息我发的消息我发的消息</view>
				<image src="../../static/images/0be7fe1465ea010524fab6dfb9a5c3fb@2x.png" />
			</view>
			<view class="main_left">
				<image src="../../static/images/1e5ed4cc9ff800cbb113cbfedd4e4d99@2x.png" />
				<view>他发的消息</view>
			</view>
		</view>
		<!-- 脚 -->
		<view class="contact_service_footer" @click="mapLocation">
			<input v-model="value" @change="onChange" />
			<image src="../../static/images/+@2x(1).png" :class="{ active: activeImg === 0 }" />
			<view :class="{ active: activeImg === 1 }">发送</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activeImg: 0, //触发事件的显示隐藏
				value: '',
			}
		},
		methods: {
		// 触发加号变成发送
		    onChange(e) {
		      let text = this.value;
		      console.log(text);
		      if (text !== '') {
		        this.activeImg = 1;
		      } else {
		        this.activeImg = 0;
		      }
		    },
			mapLocation(){
				console.log("触发了")
			}
		}
	}
</script>
<style lang="less" scoped>
	#contact_service {
		display: flex;
		flex-direction: column;
		height: 100%;

		// 身
		.contact_service_main {
			flex: 1;
			overflow-y: scroll;

			.main_right {
				display: flex;
				justify-content: flex-end;
				margin-left: 140rpx;
				margin-bottom: 30rpx;

				view {
					max-width: 470rpx;
					background: #fff;
					padding: 20rpx;
					box-sizing: border-box;
					border-radius: 10rpx;
					color: #333;
					font-size: 28rpx;
					margin-top: 14rpx;
				}

				image {
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
					margin: 0 20rpx;
				}
			}

			.main_left {
				display: flex;
				margin-right: 140rpx;
				margin-bottom: 30rpx;

				view {
					max-width: 470rpx;
					background: #fff;
					padding: 20rpx;
					box-sizing: border-box;
					border-radius: 10rpx;
					color: #333;
					font-size: 28rpx;
					margin-top: 14rpx;
				}

				image {
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
					margin: 0 20rpx;
				}
			}

			// 时间
			.time {
				display: inline-block;
				border-radius: 20rpx;
				height: 40rpx;
				line-height: 40rpx;
				background: #ccc;
				color: #fff;
				padding: 0 14rpx;
				font-size: 28rpx;
				font-weight: bold;
				margin: 40rpx auto;
				position: relative;
				left: 50%;
				transform: translate(-50%, 0);
			}
		}

		// 脚
		.contact_service_footer {
			display: flex;
			justify-content: space-between;
			background: #e1e1e1;
			padding: 20rpx;

			input {
				flex: 1;
				height: 80rpx;
				background: #fff;
				border-radius: 10px;
			}

			image {
				width: 80rpx;
				height: 80rpx;
				margin-left: 20rpx;
				display: none;
			}

			view {
				margin-left: 20rpx;
				display: none;
				width: 120rpx;
				height: 80rpx;
				line-height: 80rpx;
				background: #18cf2f;
				border-radius: 10rpx;
				text-align: center;
				color: #fff;
				font-size: 34rpx;
				font-weight: bold;
			}
		}

		.active {
			display: block !important;
		}
	}
</style>
